#include <iostream>
#include <boost/program_options.hpp>
#include <string>
#include <math.h>
#include "get_arg.h"


// link with -lboost_filesystem-gcc -lboost_program_options-gcc
// program_options_helper.cpp

#define DEBUG_LEVEL 6
#include <debug_func.h>


// my functions
#include <print_error.h>
#include <program_options_helper.h>

using std::string;
using std::cerr;
using namespace program_options_helper;
namespace po = boost::program_options_lg;


//_______________________________________________________________________________________

//		process_command_line_options

//				from command line
//				Created [9/13/2001]

//_______________________________________________________________________________________
bool process_command_line_options(int argc, char* argv[], t_program_args& args)
{

	po::options_description mandatory_args("Mandatory Arguments");
	mandatory_args.add_options()
	("species_tables,s", po::value<string>(&args.species_tables)
									->set_name("FILE"),
									"Species mapping tables generated by "
									"tree_species_mapping_function")
	("gene_to_species,g", po::value<string>(&args.gene_to_species)
									->set_name("FILE"),
									"Tab delimited column mapping gene names to the "
									"species in tree_species_mapping_function.\n");
	

	args.add_std_options();
	po::options_description all_args("");
	all_args
			.add(mandatory_args)
			.add(args.optional_args)
							;

	// parse command line
	po::variables_map vm;
	po::store(po::command_line_parser(argc, argv).options(all_args).run(), vm);
	po::notify(vm);

	if (vm.count("version"))
	{
		print_version(cerr, *argv, "1.0\n"
			"\tHistory: \n\n"
			"\tv 1.0\1"
			"13-07-2005\1"
			"Initial version\n"
			"24-07-2005\1"
			"Version 1.1\n"
//			"\tv 1.1\1"
//			"01-02-2005\1"
//			"Split programme so that vanilla version does not do anything with matrices.\n"
			);
		return false;
	}
	if (vm.count("help"))
	{
		string exe_description =
				"Takes a tree via STDIN and species mapping tables generated by "
				"tree_species_mapping_function and calculates the mapping cost.\n\n";

		print_usage(cerr, string(*argv),	"--species_tables SPECIES.MAP\n"
											"--gene_to_species GENE_TO_SPECIES.MAP\n"
											"< TREE",
							all_args, exe_description, 80);
		return false;
	}


	args.open_err_log();
	return true;
}






